# -*- coding: utf-8 -*-

"""
 (c) 2023 - Copyright CTyunOS Inc

 Authors:
   youyifeng <youyf2@chinatelecom.cn>

"""


class GenericError(Exception):
    """Base class for ease custom exceptions"""
    faultCode = 100
    fromFault = False

    def __str__(self):
        try:
            return str(self.args[0]['args'][0])
        except Exception:
            try:
                return str(self.args[0])
            except Exception:
                return str(self.__dict__)


class ConfigurationError(GenericError):
    """Raised when load of cve-ease configuration fails"""
    faultCode = 101


class RuntimeError(GenericError):
    """Raised when runtime error"""
    faultCode = 102


class InputDirNotDirError(GenericError):
    """Raised when input is not dir"""
    faultCode = 103


class CreateWorkdirError(GenericError):
    """Raised when create workdir error"""
    faultCode = 104
